// pages/onlinesigning/onlinesigning.js
const app = getApp()
const net = app.globalData.net;
Page({

  /**
   * 页面的初始数据m
   */
  data: {
     hinfo:{},
     uid:0,
     userinfo:{},
     price:0,
     statime:'2018-8-8',
     entime:'2019-9-9',
     starda1:'2018-8-8',
     enda1:'2022-9-9',
     starda2: '2018-8-8',
     enda2: '2022-9-9',
     nowtime:'',
     cash:0,
     czmo:6,
     mom:1,
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let _d = new Date();
   
    wx.getStorage({
      key: 'uid',
      success: (res) => {
        this.setData({
          uid: res.data,
        });
        wx.request({
          url: net + "/user/getuserbyId",
          method: "POST",
          data: {
            uid: res.data,
          },
          success: (res) => {
            console.log("this.data.userinfo", res.data.data)
            this.setData({
              userinfo: res.data.data,
            })
          }
        })
      },
    })
    wx.request({
      url: net + '/house/listone',
      method: 'POST',
      data: {
        hid: options.hid,
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: (res) => {
        let _cash = res.data.data.z_pay  ;
          this.setData({
            hinfo: res.data.data,
            user: res.data.data.user,
          })
        console.log("hinfo",this.data.hinfo);
      },
    });
    
  },
  bindDateChange (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      statime: e.detail.value
    })
  },
  bindDateChange1(e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      entime: e.detail.value
    })
  },
  topaystyle(){
    wx.request({
      url: net + '/user/getit',
      method:"POST",
      data:{
        order_id: this.data.userinfo.order.order_id,
        first_time: this.data.statime,
        last_time: this.data.entime,
        owe: this.data.hinfo.z_pay,
      },
      success:(res)=>{
         wx.reLaunch({
           url: '/pages/me/payStyle/payStyle',
         })
      }

    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () { 
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})